UNIX, The Series #1

What's in here

• Introduction
• DOS 2 UNIX chart
• Cool commands
• Editing your shell
• Closing

Introduction

Well hey. I'm not very good at writing, so be patient, ok?  

     UNIX, The Series is a multi-part (I hope) edition of HackAddict describing the UN*X operating system. There are lots and lots of files out there on how to hack UNIX. However, most of them either assume you are a complete UNIX guru or a complete idiot. If I read another file that says to login as "root" with the password "root" i'll scream...It's really frustrating, you know? Anyway, this first edition will talk about the "basics". And remember, the percent sign that I always type before commands (%) represents the prompt.

     NOTE: There different "flavors" of UNIX. I personally prefer BSD (Berkely Systems distribution), but I also use Linux occasionally.  (Stay away from that AT&T System V crap)  So anyway, almost all the examples in this article will work with BSD and Linux, but I can't make guarantees about other varients.

     NOTE 2: Not only are there different brands of UNIX, but UNIX has it's own operating systems, too. These operating systems are called "shells". The shell interprets the commands you give it, which it gives to the "kernel" (the core part of the system). The kernel and the shell make up the UNIX enviroment. The shell I use is the "C"
shell. To find if you are using it, type the following:

% echo $SHELL  

If you get the following

/bin/csh  (Or anything with "csh" at the end)  Then you're fine.  If you don't, type 

% csh

And you'll be put right into the C shell. (At least for now)

DOS2UNIX

     I've had a lot of requests by people who know DOS* about how to do their favorite DOS commands with UNIX. So I've prepared a chart here for anyone who knows the basic DOS commands:

*A note on DOS: I don't mind it as an operating system. Sure, it runs on PCs, but it was only stolen by Microsoft, like many other of their products. Come on, have some sympathy! And besides, as long as you type "ver" and it replies "PC-DOS v5.00" or whatever, you're safe...it's MS free!

Notice: UNIX is case sensitive.  This means that "rm DOC.DOC" and 
"rm doc.doc" are two different commands.

Cool commands that you should use:

A summary of the chart:
DIR = LS = lists contents of directory
CD = changes directory
DEL = RM = erases a file
COPY = CP = copies a file
REN = MV = renames a file
MD = MKDIR = creates new directory
DELTREE = RM -R = deletes an entire directory
TYPE = CAT = prints contents of a file to screen

Actually, those commands were pretty lame.  Now we'll get into the "nitty-gritty" of basic dull boring commands:

WHO = Shows you who's logged in.  (ALWAYS DO THIS AND WATCH OUT FOR "ROOT")

WRITE <username> = Sends whatever you type afterwards to the user's terminal.  To exit this, hit <control-d>

Example:

% write fuzebox
Hey! (hit return to send)
Stop messin with the config files!
^D  (Hit control D)

** They get this on their terminal **

Message from root@inter.net on ttyp4 at 14:23:43
Hey!
Stop messin with the config files!
EOF

TALK <username> = Sets up a split-screen chat window.  This is pretty basic, but it's a lot easier to use than write.

TELNET <address.com> = Connects you to the computer you specify.

Example:

% telnet secure.isp.com

Welcome to Security R Us!

Escape character is "["

FreeBSD v4.5

secure.isp.com    ttyp5

login:  admin
password:  

FTP <address.com> = Kind of like telnet, but lets you transfer files between computers.  Type "help" to get all the ftp commands.

PING <address.com> = A very fun program!  Pinging was covered in last months Hackaddict, but this is a UNIX version.  To ping someone innocently (to see if their computer is alive) type 

% ping dumb.windoze.user

** Depending on how your admin has set up your account, you will either get:

dumb.windoze.user is alive

** or:

Pinging dumb.windoze.user (207.120.51.234) with 32 bytes of data
Packet returned (Whole bunch of gibberish you don't care about)

Pingflooding in UNIX

(Very useful technique).  To pingflood, type the following:

% ping dumb.windoze.user -f -l 56000 &

Breakdown of elements

ping = ping command we are now familiar with
dumb...  = their address 
-f  =  pings infinetly or until killed
-l  =  sends the following size in bytes
&  =   The ampersand will cause this program to run in the background, so you can continue on your merry little way (Maybe even get some work done).

If the command I gave you doesn't work, just type "ping".  It will give you all the options, and preferably what they do.

Now that you've started this background ping, how do you stop it?

KILL <process number>  =  Will cancel a background process.

* Used in conjunction with "PS"

Example:

% ps

num      type      date
2301     csh      11/12
3201     ping     11/12

% kill 3201

And now our lovely little pingbomb is *sob* gone.

Editing your shell scripts

     Doing this will really make people think you're a UNIX power-user. You have a little login program that executes whenever you log in. Coincidently, it is called ".login". (The dot in front of the name hides the file from the standard "ls" command. To see it, type 
"ls -l")

     So anyway, to do this we'll have to use an editor. Preferably, you would type "pico .login" and have the pico editor open (very nice editor).

     So if you type "pico .login" (don't forget the dot) and you get a "invalid command" or "command not found", you'll know pico isn't on your system. So you'll have to type "vi .login", which will give you a nice but not as nice as pico editor (for sure).

Pico

     Use the arrow keys to scroll down the file. Your login file shoud contain information you might want to change. (Obvious stuff, such as "IRCNICK = "FUZEBOX"" and stuff like that.

     But once you get to the bottom, you can add your own commands, commands that get executed once you log in.  

Here are some good ones.

mesg y/n =  If your "mesg" is on, then people can use the "write" command to send you messages.  However, if you type "mesg n", only superusers can send you messages.

biff y/n =  If "biff" is y, then you'll be notified automatically if you get email.  Very handy.

cat <greeting>  =  I've got this great ascii "Good morning, Fuzebox" doc that flashes up whenever I log into my account.  Really impresses people.

who =  You can see who is online as soon as you log in.  Nice, because then you can log out immediatly if the admin is on without him noticing.

     Now, to save it hit <control-O> (That's an "O", not a "zero"). It'll ask you for the filename to save. Type ".login" if it's not already there, and then hit enter. Now hit <control-x> and you'll be finished.

VI

Supposedly a good text editor, but it's really quite ugly.

     Scroll around to where you want to type using the arrow keys.  Once you are at the spot you want to type, hit "i". This will take you from passive mode to editing mode. Now you can type whatever you want. When you are satisfied, hit <escape> to take you back to passive mode. Type a colon (:) and then type "write". This will save your file. Once you've done this, type "quit". Sure it's ugly, but it's easy, so who cares?

Conclusion

     I said at the top that I wasn't much of a writer.  Oh well.  If TW likes this article, maybe I'll make it a multi-part series, but the quality depends on reader feedback. E-mail me your opinion at: fuzebox@cyberdude.com. Did you like/dislike it? Was it too hard/easy/stupid? I don't know, I've never really written before.  

But anyway with luck there'll be a second, so see you then.

- Fuzebox